<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="format-detection" content="telephone=no" />
    <title>运行检测系统-骨干链管理-骨干节点</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link rel="stylesheet" href="/css/style.css" />
    <link rel="stylesheet" href="/css/iconfont.css" />
    <link rel="stylesheet" href="/css/element-icons.css" />
    <link rel="stylesheet" href="/css/newiconfont.css" />
    <script src="/js/jquery.min.js"></script>
    <script src="/js/lib.js"></script>
    <!--[if lt IE 9]>
        <script src="https://cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
        <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!--[if IE]>
        <link rel="stylesheet" href="/css/all-ie-only.css" />
    <![endif]-->
</head>

<body>
    <div class="header">
        <a href="javascript:;" class="header-logo">
            <img src="/images/logo.png" alt="" />
        </a>
        <div class="header-nav">
            <ul class="fix">
                <li>
                    <a href="javascript:;" class="v1">标识注册系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">标识解析系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">统一认证系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">运行检测系统</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">区块链浏览器</a>
                </li>
                <li>
                    <a href="javascript:;" class="v1">链网展示系统</a>
                </li>
            </ul>
        </div>
        <div class="header-user">
            <a href="javascript:;" class="hd">
                <img src="/images/head.png" alt="" />
                <span>管理员</span>
            </a>
            <div class="dropdown-menu">
                <div class="icon-arrow"></div>
                <ul>
                    <li class="wrz">
                        <a href="javascript:;" class="con">
                            <span>未认证</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="con">
                            <span>首页</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="con">
                            <span>资料编辑</span>
                        </a>
                    </li>
                    <li>
                        <a href="javascript:;" class="con">
                            <span>我的钱包</span>
                        </a>
                    </li>
                    <li>
                       <a onclick="logout()" class="con">
                            <span>退出</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="block-contail">
        <!-- 布局-侧边 -->
        <div class="block-left">
            <div class="block-scrollbar">
                <!-- 收起、展开按钮 -->
                <div class="arrow-btn">
                    <span class="el-icon-arrow-left"></span>
                </div>
                <!-- 收起、展开按钮 end -->
                <!-- 侧边导航 -->
                <ul class="slide-nav">
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon1-guganlianguanli"></i>
                            <span class="title">骨干链管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">基础配置</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">节点管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">合约管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">用户管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon2-zilianguanli"></i>
                            <span class="title">子链管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链申报管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链区块头</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链节点管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链用户管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">子链合约管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon3-renzhengzhongxin"></i>
                            <span class="title">认证中心</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">个人认证</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">企业认证</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">节点认证</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon newiconfont newicon6-quanxianguanli"></i>
                            <span class="title">权限管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">角色管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li>
                        <a href="javascript:;" class="v1">
                            <i class="icon_dn icon iconfont iconicon_setting"></i>
                            <span class="title">系统管理</span>
                            <i class="icon-arrow el-icon-arrow-down"></i>
                        </a>
                        <div class="slide-nav-subitem">
                            <ul>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">用户管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">系统字典</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">业务字典</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:;" class="v2">
                                        <span class="title">菜单管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                </ul>
                <!-- 侧边导航 end -->
            </div>
        </div>
        <!-- 布局-侧边 end -->
        <!-- 布局-主内容 -->
        <div class="block-main">
            <div class="block-scrollbar">
                <!-- 主内容 -->
                <div class="cur">
                    <a href="javascript:;">骨干链管理</a><em>/</em>
                    <span>骨干节点</span>
                </div>
                <div class="block-1">
                    <div class="block1-cont">
                        <div class="box-set">
                            <div class="set-bd">
                                <div class="set-item col-4">
                                    <div class="tit">节点名称:</div>
                                    <div class="con">
                                        <input id="name" type="text" class="input-inner" placeholder="请输入节点名称" />
                                    </div>
                                </div>
                                <div class="set-item col-4">
                                    <div class="tit">节点BID:</div>
                                    <div class="con">
                                        <input id="bid" type="text" class="input-inner" placeholder="请输入节点BID" />
                                    </div>
                                </div>
                                <div class="set-item col-4">
                                    <div class="tit">所在地区:</div>
                                    <div class="con">
                                        <div class="dropmenurel01 js-dropmenu" data-modulename="dropmenurel01">
                                            <input type="hidden" value="" id="region">
                                            <div class="dropmenurel01-tit">
                                                <span>所在地区</span>
                                                <i class="el-input__icon el-icon-arrow-up"></i>
                                            </div>
                                            <div class="dropmenurel01-options js-dropmenu-options">
                                                <i class="popper__arrow"></i>
                                                <ul>
                                                    <li data-value="青海">青海</li>
                                                    <li data-value="新疆">新疆</li>
                                                    <li data-value="四川">四川</li>
                                                    <li data-value="湖北">湖北</li>
                                                    <li data-value="北京">北京</li>
                                                    <li data-value="天津">天津</li>
                                                    <li data-value="宁夏">宁夏</li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="set-item col-4">
                                    <div class="tit">运行状态:</div>
                                    <div class="con">
                                        <div class="dropmenurel01 js-dropmenu" data-modulename="dropmenurel01">
                                            <input type="hidden" value="" id="runStatus">
                                            <div class="dropmenurel01-tit">
                                                <span>运行状态</span>
                                                <i class="el-input__icon el-icon-arrow-up"></i>
                                            </div>
                                            <div class="dropmenurel01-options js-dropmenu-options">
                                                <i class="popper__arrow"></i>
                                                <ul>
                                                    <li data-value="0">正常</li>
                                                    <li data-value="1">告警</li>
                                                    <li data-value="2">故障</li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="set-bt">
                                <a href="javascript:;" class="primary-btn" id="search">
                                    <i class="icon_dn el-icon-search"></i>
                                    <span>搜索</span>
                                </a>
                                <a href="javascript:;" id="reset">
                                    <i class="icon_dn el-icon-refresh"></i>
                                    <span>重置</span>
                                </a>
                            </div>
                        </div>
                        <div class="box-set4">
                            <div class="info">故障节点：<span id="total"></span>个</div>
                            <ul class="radio-group2 js-custom-radio-checkbox" data-modulename="formrel01">
                                <li onclick="setNodetype('')">
                                    <label>
                                        <input type="radio" name="2" checked />
                                        <i class="icon"></i>
                                        <span>全部节点</span>
                                    </label>
                                </li>
                                <li onclick="setNodetype(3)">
                                    <label>
                                        <input type="radio" name="2" />
                                        <i class="icon"></i>
                                        <span>共识节点</span>
                                    </label>
                                </li>
                                <li onclick="setNodetype(2)">
                                    <label>
                                        <input type="radio" name="2" />
                                        <i class="icon"></i>
                                        <span>候选节点</span>
                                    </label>
                                </li>
                                <li onclick="setNodetype(1)">
                                    <label>
                                        <input type="radio" name="2" />
                                        <i class="icon"></i>
                                        <span>可信节点</span>
                                    </label>
                                </li>
                                <li onclick="setNodetype(0)">
                                    <label>
                                        <input type="radio" name="2" />
                                        <i class="icon"></i>
                                        <span>同步节点</span>
                                    </label>
                                </li>
                            </ul>
                        </div>
                        <div class="data-content table-scroll-x">
                            <div class="table1-head table-1">
                                <table>
                                    <colgroup>
                                        <col name="" width="50">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="120">
                                    </colgroup>
                                    <thead>
                                        <tr>
                                            <th>序号</th>
                                            <th>节点名称</th>
                                            <th>节点BID</th>
                                            <th>节点类型</th>
                                            <th>所在地区</th>
                                            <th>运行状态</th>
                                            <th>创建时间</th>
                                            <th class="table1_center">操作</th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                            <div class="table1-body table-1">
                                <table>
                                    <colgroup>
                                        <col name="" width="50">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="NaN">
                                        <col name="" width="120">
                                    </colgroup>
                                    <tbody id="table"></tbody>
                                </table>
                            </div>
                        </div>
                        <!--<div class="pages">
                            <ul id="pageList"></ul>
                            <div class="pages-go">
                                前往
                                <input type="number" value="1" class="input-inner" onclick="changePageSize(10)" />
                                页
                                <div class="pages-prev pages-disable"><a href="javascript:;"><i
                                            class="el-icon el-icon-arrow-left"></i></a></div>
                            </div>
                            <div class="dropmenurel01 js-dropmenu" data-modulename="dropmenurel01">
                                <input type="hidden" value="0">
                                <div class="dropmenurel01-tit">
                                    <span>请选择</span>
                                    <i class="el-input__icon el-icon-arrow-up"></i>
                                </div>
                                <div class="dropmenurel01-options js-dropmenu-options">
                                    <i class="popper__arrow"></i>
                                    <ul>
                                        <li data-value="1" onclick="changePageSize(10)">10条/页</li>
                                        <li data-value="2" onclick="changePageSize(20)">20条/页</li>
                                        <li data-value="3" onclick="changePageSize(30)">30条/页</li>
                                        <li data-value="4" onclick="changePageSize(40)">40条/页</li>
                                        <li data-value="5" onclick="changePageSize(50)">50条/页</li>
                                        <li data-value="6" onclick="changePageSize(100)">100条/页</li>
                                    </ul>
                                </div>
                            </div>
                        </div>-->
                    </div>
                </div>
                <!-- 主内容 end -->
            </div>
        </div>
        <!-- 布局-主内容 end -->
    </div>
    <!-- 显隐 end -->
    <script src="/js/module.js"></script>
    <script type="text/javascript">
        var currentSize = 10;
        var currentPage = 1;
        var num = 0;
        var currentItem = {};
        var currentNodeType = "";
        var runStatusList = ['正常', '告警', '故障'];
        var nodeTypeList = ['同步节点', '可信节点', '候选节点', '共识节点'];

        var tablelist = function (page, size, params, nodeType) {
            $request({
                url: '/GT_API/blade-DWHCMS/api/chainNode/listByCondition?name=' + params.name + '&bid=' + params.bid + '&region=' + params.region
                        + '&runStatus=' + params.runStatus + '&nodeType=' + nodeType + '&current=' + page + '&size=' + size,
                method: 'post',
                data: JSON.stringify(params)
            }, function (res) {
                var list = res.records;
                var anonymousAccessList = ['不允许', '允许'];
                var guzhang = 0;
                $.each(list, function(i, n){
                    if(n.runStatus === 2){
                        guzhang += 1;
                    }
                });
                num = Math.ceil(res.records.total / currentSize);
                currentNodeType = nodeType
                var template = '';
                $('#table').children().remove();
                $('#total').html(guzhang);
                if(list == "" || list.length == 0){
                    template += "<tr class='table1'>";
                    template += "<td colspan='8' style='text-align: center;'>暂无数据</td>";
                    template += "</tr>";
                }else{
                    $.each(list, function(i, x){
                        template += "<tr class='table1'>" +
                            "<td>" + (i + 1) + "</td>" +
                            "<td>" + x.name + "</td>" +
                            "<td>" + x.bid + "</td>" +
                            "<td>" + nodeTypeList[x.nodeType] + "</td>" +
                            "<td>" + x.region + "</td>" +
                            "<td>" + runStatusList[x.runStatus] + "</td>" +
                            "<td>" + x.createTime + "</td>" +
                            "<td>" +
                            "<div class='table1-btn'>" +
                            "<a href='/monitor/gulian/nodeDetail.html?bid=" + x.bid + "nodeType=" + x.nodeType + "'>详情</a>" +
                            "</div>" +
                            "</td>" +
                            "</tr>"
                    });
                }
                $('#table').append(template);
                pageNumInit(num);
            })
        }
        // 分页页码
        var pageNumInit = function (num) {
            $('#pageList').children().remove();
            if (num === 1) {
                $('#pageList').append(
                    "<li class='pages-prev pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                    getPageNum(num) +
                    "<li class='pages-next pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
                );
            }
            else if (currentPage === 1) {
                $('#pageList').append(
                    "<li class='pages-prev pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                    getPageNum(num) +
                    "<li class='pages-next' onclick='changePageSize(" + currentSize + "," + (currentPage + 1) + ",this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
                );
            }
            else if (currentPage === num) {
                $('#pageList').append(
                    "<li class='pages-prev' onclick='changePageSize(" + currentSize + "," + (currentPage - 1) + ",this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                    getPageNum(num) +
                    "<li class='pages-next pages-disable'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
                );
            }
            else {
                $('#pageList').append(
                    "<li class='pages-prev' onclick='changePageSize(" + currentSize + "," + (currentPage - 1) + ",this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-left'></i></a></li>" +
                    getPageNum(num) +
                    "<li class='pages-next' onclick='changePageSize(" + currentSize + "," + (currentPage + 1) + ", this)'><a href='javascript:;'><i class='el-icon el-icon-arrow-right'></i></a></li>"
                );
            }
        }
        // 分页拼接
        var getPageNum = function (num) {
            var result = '';
            for (var i = 0; i < num; i++) {
                if (i === 0) {
                    result += "<li class='pages-active' onclick='changePageSize(" + currentSize + "," + 1 + ",this)'><a href='javascript:;'>1</a></li>";
                }
                else {
                    result += "<li onclick='changePageSize(" + currentSize + "," + (i + 1) + ",this)'><a href='javascript:;'>" + (i + 1) + "</a></li>";
                }
            }
            return result;
        }
        // 搜索
        $('#search').click(function () {
            var params = {
                name: $('#name').val(),
                bid: $('#bid').val(),
                region: $('#region').val(),
                runStatus: $('#runStatus').val(),
            }
            console.log('搜索参数', params);
            tablelist(1, 10, params, currentNodeType);
        })
        // 重置
        $('#reset').click(function () {
            $('#name').val('');
            $('#bid').val('');
            $('#region').val('');
            $('#runStatus').val('');
            console.log('重置');
            init();
        })
        // 
        function setNodetype(type) {
            currentNodeType = type;
            var params = {
                name: $('#name').val(),
                bid: $('#bid').val(),
                region: $('#region').val(),
                runStatus: $('#runStatus').val(),
            }
            tablelist(1, 10, params, type);
        }
        // 分页
        var changePageSize = function (size, pageNo, current) {
            var params = {
                name: $('#name').val(),
                bid: $('#bid').val(),
                region: $('#region').val(),
                runStatus: $('#runStatus').val(),
            }
            var page = pageNo ? pageNo : $('#pageNum').val() ? $('#pageNum').val() : 1;
            currentSize = size ? size : 10;
            currentPage = Number(page);
            tablelist(page, size, params, currentNodeType);
            pageNumInit(num);
        }
        //
        function init() {
            currentItem = {};
            tablelist(1, 10, { name: "", bid: "", region: "", runStatus: "" }, '')
        }
        init();
    </script>
</body>

</html>